struct ContentView: View {
    @State private var clickCount = 0

    var body: some View {
        Button(action: {
            self.clickCount += 1
        }) {
            Text("Clicked \(self.clickCount) time(s)")
                .padding()
                .background(Color.blue)
                .foregroundColor(.white)
                .cornerRadius(8.0)
        }
    }
}

struct SearchBarWrapper: UIViewRepresentable {
    
    @Binding var text: String
    
    class Coordinator : NSObject, UISearchBarDelegate {
        
        @Binding var text: String
        
        init(text: Binding<String>) {
            _text = text
        }
        
        func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
            text = searchText
        }
    }

    func makeCoordinator() -> Coordinator {
        return Coordinator(text: $text)
    }
    
    func makeUIView(context: Context) -> UISearchBar {
        let searchBar = UISearchBar(frame: .zero)
        searchBar.delegate = context.coordinator
        return searchBar
    }
    
    func updateUIView(_ uiView: UISearchBar, context: Context) {
        uiView.text = text
    }
}